//
//  LDBaseCustomizeNAVVC.swift
//  DingDongZP
//
//  Created by 三秒文化 on 16/7/28.
//  Copyright © 2016年 51ledian.com. All rights reserved.
//

import UIKit

class LDBaseCustomizeVC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        navigationController?.navigationBar.barTintColor = LDGolbalColor.Green
        navigationController?.navigationBar.tintColor = UIColor.whiteColor()
        //        navigationController?.navigationBar.translucent = false
        navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName : LDFont.Font16,NSForegroundColorAttributeName:LDGolbalColor.White]

        
        navigationController?.navigationBar.translucent = false
    }
    
    override func viewWillAppear(animated: Bool) {
        
        navigationController?.navigationBar.barTintColor = LDGolbalColor.Green
        navigationController?.navigationBar.tintColor = UIColor.whiteColor()
        //        navigationController?.navigationBar.translucent = false
        navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName : LDFont.Font16,NSForegroundColorAttributeName:LDGolbalColor.White]
        navigationController?.navigationBar.translucent = false
    }
    
//    override func preferredStatusBarStyle() -> UIStatusBarStyle {
//        
//       return super.preferredStatusBarStyle()
//    }
    

    
    override func customBackItemWithTarget(target: AnyObject!, action: Selector) -> UIBarButtonItem! {
     
        let barLeft = UIBarButtonItem(image: UIImage(named:"navBack.png"), style: UIBarButtonItemStyle.Plain, target: self, action:#selector(self.navback))
        return barLeft
    }
    
    func navback() {
        
        self.navigationController?.popViewControllerAnimated(true)
    }
    
    
    func registerKeyboard() {
        
//        UIApplication.sharedApplication().sendAction(#selector(resignFirstResponder), to: nil, from: nil, forEvent: nil)
        UIApplication.sharedApplication().keyWindow?.endEditing(true)
    }
    
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {

        registerKeyboard()
    }

}

